package org.example.config;

import org.example.model.Article;
import org.example.model.User;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class DataConfig {

    @Bean
    public User user(){
        User user = new User();
        user.setUsername("abc");
        user.setPassword("123");
        user.setNickname("我不是汤神");
        return user;
    }

    @Bean
    public List<Article> articleList(){
        List<Article> list = new ArrayList<>();
        Article a1 = new Article();
        a1.setId(1);
        a1.setTitle("a");
        a1.setContent("aaaaaa");
        list.add(a1);

        Article a2 = new Article();
        a2.setId(2);
        a2.setTitle("b");
        a2.setContent("bbbbbbb");
        list.add(a2);

        Article a3 = new Article();
        a3.setId(3);
        a3.setTitle("c");
        a3.setContent("cccccc");
        list.add(a3);
        return list;
    }
}
